﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Log.aspx.cs" Inherits="SwenAssigment.Log" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style5 {
            width: 93px;
        }
        .auto-style6 {
            width: 587px;
        }
        .auto-style7 {
            width: 586px;
        }
        .auto-style8 {
            width: 585px;
        }
        .auto-style9 {
            width: 368px;
        }
        .auto-style10 {
            width: 93px;
            height: 29px;
        }
        .auto-style11 {
            width: 368px;
            height: 29px;
        }
        .auto-style12 {
            height: 29px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>User Log</h1>
    <div>

        <asp:Button ID="Button3" runat="server" Text="Display All" OnClick="Button3_Click" />
        <br />
        <table style="width:100%;">
            <tr>
                <td class="auto-style10">Username:</td>
                <td class="auto-style11">
        <asp:TextBox ID="TextBox2" runat="server" ValidationGroup="vv"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox2" ErrorMessage="*Require" ForeColor="Red" ValidationGroup="vv"></asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator7" runat="server" ControlToValidate="TextBox2" ErrorMessage="*Allow only letter min 4 max 20" ForeColor="Red" ValidationExpression="[a-zA-Z]{4,20}$" ValidationGroup="vv"></asp:RegularExpressionValidator>

                </td>
                <td class="auto-style12">

        <asp:Button ID="Button5" runat="server" Text="Search" ValidationGroup="vv" OnClick="Button5_Click" />

                </td>
            </tr>
            <tr>
                <td class="auto-style5">Date (select using calendar):</td>
                <td class="auto-style9">
                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:TextBox ID="TextBox3" runat="server" ReadOnly="True" ValidationGroup="vvv"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="TextBox3" ErrorMessage="*Require" ForeColor="Red" ValidationGroup="vvv"></asp:RequiredFieldValidator>
                            <asp:Calendar ID="Calendar1" runat="server" OnDayRender="Calendar1_DayRender" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td>

        <asp:Button ID="Button6" runat="server" Text="Search" ValidationGroup="vvv" OnClick="Button6_Click" />

                </td>
            </tr>
            <tr>
                <td class="auto-style5">&nbsp;</td>
                <td class="auto-style9">
                    &nbsp;</td>
                <td>&nbsp;</td>
            </tr>
        </table>

    </div>
    <div>

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="True" PageSize="5">
            <Columns>
                <asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" />
                <asp:BoundField DataField="LoginDateTime" HeaderText="LoginDateTime" SortExpression="LoginDateTime" />
                <asp:BoundField DataField="Staff_Name" HeaderText="Staff_Name" SortExpression="Staff_Name" />
                <asp:BoundField DataField="Contact_Number" HeaderText="Contact_Number" SortExpression="Contact_Number" />
            </Columns>
            <EmptyDataTemplate>
                No Data!
            </EmptyDataTemplate>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [ViewLog] ORDER BY [LoginDateTime] DESC"></asp:SqlDataSource>

    </div>
</asp:Content>
